
package com.zhaoyan.okgorxjavademo;

import android.text.TextUtils;


import com.google.gson.reflect.TypeToken;
import com.lzy.okgo.model.HttpMethod;
import com.lzy.okgo.model.HttpParams;

import java.io.File;
import java.util.List;

import io.reactivex.Observable;

public class ServerApi {
    public static Observable<LzyResponse<List<Contacts>>> getContacats(String orgCode, String name) {
        HttpParams params = new HttpParams();
        params.put("orgCode", orgCode);
        params.put("userName", name);
        params.put("rows", "99999");
        return RxUtils.request(HttpMethod.POST, Urls.CONTACTS, new TypeToken<LzyResponse<List<Contacts>>>() {
        }.getType(), params, null);
    }

    public static Observable<Contacts1> getContacats1(String orgCode, String name) {
        HttpParams params = new HttpParams();
        params.put("orgCode", orgCode);
        params.put("userName", name);
        params.put("rows", "99999");
        return RxUtils.request(HttpMethod.POST, Urls.CONTACTS, Contacts1.class, params, null);
    }

    public static Observable<LzyResponse<Login>> login() {
        HttpParams params = new HttpParams();
        params.put("username", "zhaoyan");
        params.put("password", "123456");
        params.put("projectId", "");
        params.put("dev_type", "android");
        return RxUtils.request(HttpMethod.POST, Urls.LOGIN, new TypeToken<LzyResponse<Login>>() {
        }.getType(), params, null);
    }
}
